const app = getApp();
const db = wx.cloud.database({
  throwOnNotFound: false
})
Page({
  data: {
    issuesList:[],
    comment:'',
    like:'',
    imgList:[],
  },

onLoad:function(options){
  console.log(options)
  wx.cloud.callFunction({
    name:"queryIssues",
    success:res =>{
      console.log("查询动态成功",res)
   
      this.setData({
        issuesList:res.result.data,
        
      })
    }
  });


},
onShow:function(){
  wx.cloud.callFunction({
    name:"queryIssues",
    success:res =>{
      this.setData({
        issuesList:res.result.data
      })
    }
  })

},
ViewImage(e) {
  console.log(e)

  wx.previewImage({
    urls: e.currentTarget.dataset.imglist,
    current: e.currentTarget.dataset.url
  });
},

  //下拉刷新
  onPullDownRefresh() {
    wx.showNavigationBarLoading({
      complete: (res) => {
        wx.showToast({
          title: '数据刷新中',
          mask: true,
          icon: "loading",
          duration: 2000
        })
        this.onLoad();
        wx.hideNavigationBarLoading({
          complete: (res) => {
            wx.stopPullDownRefresh({
            },3000)
          },
        })
      },
    })
  }

});